package com.pig4cloud.pigx.system.constant;

import lombok.Getter;

public enum EmailTemplateTypeEnum {

	/**
	 * 合约强制平仓通知
	 */
	FORCED_LIQUIDATION_OF_CONTRACTS("合约强制平仓通知", null, "1563415493535264768,1563415882619875328"),
	/**
	 * 合约追加保证金
	 */
	CONTRACT_MARGIN_CALL("合约追加保证金", null, "1563415493535264768,1563415994377105408"),
	/**
	 * 确认提现
	 */
	CONFIRM_WITHDRAWAL("确认提现", null, "1563415493535264768,1563416379904946176"),
	/**
	 * 提现成功
	 */
	WITHDRAWAL_SUCCESS("提现成功", null, "1563415493535264768,1563422664922689536"),
	/**
	 * 充值成功
	 */
	RECHARGED_SUCCESSFULLY("充值成功", null, "1563415493535264768,1563840055018180608"),
	/**
	 * 用户注册
	 */
	USER_REGISTRATION("用户注册", "CustomerRegistration", "1563415493535264768,1563425956063014912"),
	/**
	 * 用户修改邮箱
	 */
	USER_CHANGES_EMAIL("用户修改邮箱", "CustomerModifyEmail", "1563415493535264768,1563426261370597376"),
	/**
	 * 用户修改支付密码
	 */
	USER_CHANGES_PAYMENT_PASSWORD("用户修改支付密码 ", "CustomerModifyMoneyPassword", "1563415493535264768,1563426774375919616"),
	/**
	 * 成为经纪人
	 */
	BECOME_BROKER("成为经纪人", "BecomeBroker", "1563415493535264768,1574649347681890305"),
	/**
	 * 经纪人返佣到账
	 */
	BROKER_RECEIVED_THE_COMMISSION("经纪人返佣到账", null, "1563415493535264768,1574649475801100290"),
	/**
	 * 资金账户后台-充值/奖励/平台手工
	 */
	FUND_ACCOUNT_BACKGROUND_RECHARGE("资金账户后台-资金充值", null, "1563415493535264768,1579457127578869761"),
	/**
	 * 资金账户后台-冻结/解冻
	 */
	FUND_ACCOUNT_BACKGROUND_FROZEN("资金账户后台-冻结/解冻", null, "1563415493535264768,1579457280129900545"),
	/**
	 * 意见反馈已通过
	 */
	FEEDBACK_WAS_ACCEPTED("意见反馈已通过", null, "1563415493535264768,1580866101288968193"),
	/**
	 * 用户创建ApiKey
	 */
	USER_API_KEY_CREATE("用户创建ApiKey ", "CustomerApiKeyCreate", "1563415493535264768,1587322868700221442"),
	/**
	 * 用户开启ApiKey提现权限
	 */
	USER_API_KEY_ENABLE_WITHDRAWAL("用户开启ApiKey提现权限 ", "CustomerApiKeyEnableWithdrawal", "1563415493535264768,1587323133868314626"),
	/**
	 * 客户查询SecretKey
	 */
	CUSTOMER_SECRET_KEY_SELECT("用户开启ApiKey提现权限 ", "CustomerSecretKeySelect", "1563415493535264768,1592427508411879425");

	/**
	 * 文章类型名称
	 */
	@Getter
	private String name;

	/**
	 * 文章类型编号（代码用）
	 */
	@Getter
	private String code;

	/**
	 * 数据库文章类型编号
	 */
	@Getter
	private String articleTypeCode;

	EmailTemplateTypeEnum(String name, String code, String articleTypeCode) {
		this.name = name;
		this.code = code;
		this.articleTypeCode = articleTypeCode;
	}

	public static String findArticleTypeCodeByCode(String code) {
		for (EmailTemplateTypeEnum emailTemplateType : values()) {
			if (emailTemplateType.code != null && emailTemplateType.code.equals(code)) {
				return emailTemplateType.articleTypeCode;
			}
		}
		return null;
	}
}
